package com.ruoyi.wcf.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.wcf.domain.WcfRecommendCollect;
import com.ruoyi.wcf.service.IWcfRecommendCollectService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 产品展示-推荐商品收藏Controller
 * 
 * @author LCL
 * @date 2022-04-06
 */
@RestController
@RequestMapping("/wcf/WcfRecommendCollect")
public class WcfRecommendCollectController extends BaseController
{
    @Autowired
    private IWcfRecommendCollectService wcfRecommendCollectService;

    /**
     * 查询产品展示-推荐商品收藏列表
     */
    @PreAuthorize("@ss.hasPermi('wcf:WcfRecommendCollect:list')")
    @GetMapping("/list")
    public TableDataInfo list(WcfRecommendCollect wcfRecommendCollect)
    {
        startPage();
        List<WcfRecommendCollect> list = wcfRecommendCollectService.selectWcfRecommendCollectList(wcfRecommendCollect);
        return getDataTable(list);
    }

    /**
     * 导出产品展示-推荐商品收藏列表
     */
    @PreAuthorize("@ss.hasPermi('wcf:WcfRecommendCollect:export')")
    @Log(title = "产品展示-推荐商品收藏", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(WcfRecommendCollect wcfRecommendCollect)
    {
        List<WcfRecommendCollect> list = wcfRecommendCollectService.selectWcfRecommendCollectList(wcfRecommendCollect);
        ExcelUtil<WcfRecommendCollect> util = new ExcelUtil<WcfRecommendCollect>(WcfRecommendCollect.class);
        return util.exportExcel(list, "产品展示-推荐商品收藏数据");
    }

    /**
     * 获取产品展示-推荐商品收藏详细信息
     */
    @PreAuthorize("@ss.hasPermi('wcf:WcfRecommendCollect:query')")
    @GetMapping(value = "/{collectId}")
    public AjaxResult getInfo(@PathVariable("collectId") Long collectId)
    {
        return AjaxResult.success(wcfRecommendCollectService.selectWcfRecommendCollectByCollectId(collectId));
    }

    /**
     * 新增产品展示-推荐商品收藏
     */
    @PreAuthorize("@ss.hasPermi('wcf:WcfRecommendCollect:add')")
    @Log(title = "产品展示-推荐商品收藏", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WcfRecommendCollect wcfRecommendCollect)
    {
        return toAjax(wcfRecommendCollectService.insertWcfRecommendCollect(wcfRecommendCollect));
    }

    /**
     * 修改产品展示-推荐商品收藏
     */
    @PreAuthorize("@ss.hasPermi('wcf:WcfRecommendCollect:edit')")
    @Log(title = "产品展示-推荐商品收藏", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WcfRecommendCollect wcfRecommendCollect)
    {
        return toAjax(wcfRecommendCollectService.updateWcfRecommendCollect(wcfRecommendCollect));
    }

    /**
     * 删除产品展示-推荐商品收藏
     */
    @PreAuthorize("@ss.hasPermi('wcf:WcfRecommendCollect:remove')")
    @Log(title = "产品展示-推荐商品收藏", businessType = BusinessType.DELETE)
	@DeleteMapping("/{collectIds}")
    public AjaxResult remove(@PathVariable Long[] collectIds)
    {
        return toAjax(wcfRecommendCollectService.deleteWcfRecommendCollectByCollectIds(collectIds));
    }
}
